package com.wu.llpsw.data;


import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Player;
import com.wu.llpsw.yuanli.energy.yuanliManager;
public class levelData {
    //等级名称
    public static String[] leveName =new String[]{
            "命土境初期",
            "命土境中期",
            "命土境后期",
            "通幽境初期",
            "通幽境中期",
            "通幽境后期",
            "遨虚境初期",
            "遨虚境中期",
            "遨虚境后期",
            "领域-掌中乾坤",
            "领域-背负青天",
            "领域-项上三苍",
            "圣境"
    };

    //玩家攻击力数据,小境界提升一级+5，大境界*2,
    public static long[] maxAttackValue=new long[]{1,6,11,22,27,32,64,69,74,148,153,158,316};
    //玩家生命值数据,小境界提升一级+5，大境界*2,
    public static long[] maxHealthValue=new long[]{20,25,30,60,65,70,140,145,150,300,305,310,620};
    //玩家元力数据,小境界提升一级+20，大境界*2,
    public static int[] maxYuanliValue=new int[]{101,121,141,281,301,321,641,661,681,1361,1381,1401,2801};
    //玩家防御力数据,小境界提升一级+1，大境界*2,
    public static long[] maxFangyuValue=new long[]{0,1,2,4,5,6,12,13,14,28,29,30,60};

    //范围
    public static int[] maxRangeValue=new int[]{4,5,6,7,8,9,10,11,12,13,14,15,16};
    public static int index=0;

    public static String getLevelName(int xpLevel){
        int index= (int)xpLevel/10;//获取玩家等级索引;
        if(index<maxYuanliValue.length){
            return leveName[index];
        }
        else {
            return leveName[maxYuanliValue.length-1];
        }
    }
    public static int getLevel(int xpLevel){
        int index= (int)xpLevel/10;//获取玩家等级索引;
        if(index<maxYuanliValue.length){
            return index;
        }
        else {
            return maxYuanliValue.length-1;
        }
    }
    //修正玩家的的等级
    public static void setParam(Player player, int xp){
        index=(int)xp/10;//获取玩家等级索引


        if(index<maxYuanliValue.length){


            //设置玩家最大生命
            playerData.setMaxtHealth(player,maxHealthValue[index]+xp+tianFu.getLevel()*10*tianFu.addhealththis);

            //设置玩家最大攻击力
            playerData.setAttack(player,maxAttackValue[index]+xp+tianFu.getLevel()*2*tianFu.addattackthis);
            //设置玩家护甲值,突破后获得不可再生的护甲值
            playerData.setFangyu(player,maxFangyuValue[index]);
            //设置玩家的元力
            yuanliManager.setMax(player,(int) (maxYuanliValue[index]+tianFu.getLevel()*5*tianFu.addyuanlithis));
        }
        else {
            index=maxYuanliValue.length-1;
            //设置玩家最大生命
            playerData.setMaxtHealth(player,maxHealthValue[index]+xp+tianFu.getLevel()*10*tianFu.addhealththis);
            //设置玩家最大攻击力
            playerData.setAttack(player,maxAttackValue[index]+xp+tianFu.getLevel()*2*tianFu.addattackthis);
            //设置玩家护甲值,突破后获得不可再生的护甲值
            playerData.setFangyu(player,maxFangyuValue[index]);
            //设置玩家的元力
            yuanliManager.setMax(player,(int)(maxYuanliValue[index]+tianFu.getLevel()*5*tianFu.addyuanlithis));
        }
    }
}
